package com.xgq.drink.mapper;

import com.xgq.drink.entity.ChatAttachment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 聊天附件表 Mapper 接口
 * </p>
 *
 * @author xgq
 * @since 2025-05-16
 */
public interface ChatAttachmentMapper extends BaseMapper<ChatAttachment> {
    @Insert("INSERT INTO chat_attachment (message_id, file_url, file_name, file_type, file_size) " +
            "VALUES " +
            "<foreach collection='list' item='item' separator=','> " +
            "(#{item.messageId}, #{item.fileUrl}, #{item.fileName}, #{item.fileType}, #{item.fileSize}) " +
            "</foreach>")
    void batchInsert(@Param("list") List<ChatAttachment> attachments);
}
